﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace ebc.componentbinder
{
    internal static class ReflectionExtensions
    {
        public static bool IsEbcEvent(this EventInfo eventInfo)
        {
            return DelegateAnalysis.GetDelegateReturnType(eventInfo.EventHandlerType) == typeof (void) &&
                   DelegateAnalysis.GetDelegateParameterTypes(eventInfo.EventHandlerType).Length == 1;
        }

        public static bool IsEbcMethod(this MethodInfo methodInfo)
        {
            return methodInfo.GetParameters().Length == 1 &&
                   methodInfo.ReturnParameter.ParameterType == typeof (void);
        }
    }
}
